﻿using System;

namespace AMS.DataAccess.Trademark.BO
{
    [DBTable("TT_RecvFile")]
    public class RecvFileInfo
    {
        #region Database Column Fields
        [DBPrimaryKeyColumn("AID", true)]
        public int AID { get; set; }

        [DBForignKeyColumn("RFIndex", "TTD_RF")]
        public string RFIndex { get; set; }

        [DBColumn("RFName")]
        public string RFName { get; set; }

        [DBColumn("CustomerID", 0)]
        public int CustomerID { get; set; }

        [DBColumn("CaseID", 0)]
        public int CaseID { get; set; }

        [DBColumn("Source")]
        public string Source { get; set; }

        [DBColumn("OfficeID", 0)]
        public int OfficeID { get; set; }

        [DBDateTime("RecvDate", DateTimeType.DateTime, false, false)]
        public DateTime RecvDate { get; set; }

        [DBDateTime("FileSentDate", DateTimeType.Date, false, false)]
        public DateTime FileSentDate { get; set; }

        [DBColumn("isScanned", true, false)]
        public bool isScanned { get; set; }

        [DBColumn("isGenTask", true, false)]
        public int isGenTask { get; set; }

        [DBColumn("isEndTask", true, false)]
        public int isEndTask { get; set; }

        [DBColumn("isChecked")]
        public bool isChecked { get; set; }

        [DBColumn("RFContent")]
        public string RFContent { get; set; }

        [DBDateTime("AnswerDate", DateTimeType.Date, false, false)]
        public DateTime AnswerDate { get; set; }

        [DBDateTime("CreateDateTime", DateTimeType.DateTime, false, true)]
        public DateTime CreateDateTime { get; set; }

        [DBColumn("CreateUserID", false, true)]
        public int CreateUserID { get; set; }

        #endregion

        /// <summary>
        /// Display field
        /// </summary>
        [DBColumn("CaseIndex", true, true)]
        public string CaseIndex { get; set; }

        [DBColumn("CustomerName", true, true)]
        public string CustomerName { get; set; }

        [DBColumn("OfficeName", true, true)]
        public string OfficeName { get; set; }

        public string FromName
        {
            get
            {
                if (Source == "O")
                {
                    return OfficeName;
                }
                else
                {
                    return CustomerName;
                }
            }
        }
    }
}
